package course;

public class Student {
    private String studentId;
    private String name;

    public Student(String studentId, String name) {
        this.studentId = studentId;
        this.name = name;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void selectCourse(Course course) {
        try {
            course.enrollStudent();
            System.out.println(name + " 选课成功：" + course.getCourseName());
        } catch (CourseFullException e) {
            System.out.println(name + " 选课失败：" + e.getMessage());
        }
    }
}
